package com.aldobucchi.utils
{
	
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	import com.aldobucchi.core.dependency.DependencyHelper;
	import com.aldobucchi.core.dependency.DependencySpec;



/**
 *  
 * Dispatched when any value of this VO changes
 * 
 *  @eventType flash.events.Event.CHANGE
 */
[Event(name="change", type="flash.events.Event")]	



	/**
	 * 
	 * A two dimensional camera value object that holds x, y and zoom.
	 * 
	 * @author aldo.bucchi@gmail.com
	 * 
	 */
	public class Camera2DVO extends EventDispatcher
	{


		protected var dh:DependencyHelper;


		/////////////////////////////////////
		// x
		/////////////////////////////////////
		
		private var xSpec:DependencySpec = new DependencySpec( "x", "xChanged" );
		[Bindable("xChanged")]
		public function get x( ):int
		{
			return dh.getDependencyValue( xSpec );
		}
		
		public function set x( v:int ):void
		{
			dh.setDependencyValue( xSpec, v );
		}
		
		
		
		/////////////////////////////////////
		// y
		/////////////////////////////////////
		
		private var ySpec:DependencySpec = new DependencySpec( "y", "yChanged" );
		[Bindable("yChanged")]
		public function get y( ):int
		{
			return dh.getDependencyValue( ySpec );
		}
		
		public function set y( v:int ):void
		{
			dh.setDependencyValue( ySpec, v );
		}
		


		/////////////////////////////////////
		// zoom
		/////////////////////////////////////
		
		private var zoomSpec:DependencySpec = new DependencySpec( "zoom", "zoomChanged" );
		[Bindable("zoomChanged")]
		public function get zoom( ):int
		{
			return dh.getDependencyValue( zoomSpec );
		}
		
		public function set zoom( v:int ):void
		{
			dh.setDependencyValue( zoomSpec, v );
		}
		
		
		
		
		
		
		public function Camera2DVO( )
		{
		
			dh = new DependencyHelper( this, update );
		
		}
		
		
		
		
		protected function update( ):void
		{
		
			dispatchEvent( new Event( Event.CHANGE ) );
		
		}
		
		

		
	}
}